Skip to content

Conversation

@shivasankarka
Copy link
Collaborator

@shivasankarka shivasankarka commented Sep 25, 2025

This PR adds foundational support for future NDArray indexing features, introduces several new array operations, refines internal APIs to align with Mojo standard library conventions, and fixes correctness issues in edge cases such as zero-dimensional arrays.

Added

  1. Support for Ellipsis and a NewAxis to enable upcoming indexing and slicing functionality.
  2. deep_copy methods for Item, NDArrayShape, and NDArrayStrides, returning a copy with a new origin and identical elements.
  3. Array comparison methods allclose, isclose, and array_equal for ndarray and matrix.
  4. Infinity checks isneginf and isposinf for ndarray and matrix.
  5. Logical operations logical_and, logical_or, logical_not, and logical_xor for ndarray, matrix, and complexndarray.
    meshgrid function for NDArray inputs.

Changed

  1. Updated Item, NDArrayShape, and NDArrayStrides to use the latest UnsafePointer API with MutOrigin.external.
  2. Renamed internal data type fields in Item, NDArrayShape, and NDArrayStrides to element_type to align with Mojo standard library conventions.
  3. Improved and expanded docstrings across modified modules.

Fixed

  1. Correct handling of ndim = 0 cases in Item, NDArrayShape, and NDArrayStrides by allocating a single dimension.

Notes

  1. Several changes are preparatory for future indexing and slicing enhancements.
  2. Internal refactors are intended to improve consistency with Mojo stdlib APIs and may affect downstream internal extensions relying on private fields.

@shivasankarka shivasankarka changed the title [Core][NDArray][ComplexNDArray] Improvements to __getitem__ method of Arrays [Core][Item] Update Item, NDArrayShape, NDArrayStrides Dec 12, 2025
@shivasankarka shivasankarka changed the title [Core][Item] Update Item, NDArrayShape, NDArrayStrides [Core] Add foundational NDArray features, API refinements, and new array operations Jan 2, 2026
@shivasankarka shivasankarka requested a review from forfudan January 2, 2026 14:05
@shivasankarka shivasankarka marked this pull request as ready for review January 2, 2026 23:53
@shivasankarka shivasankarka merged commit bfcf1c3 into Mojo-Numerics-and-Algorithms-group:pre-0.8 Jan 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants